/**
 * @fileOverview
 * 天气选择器
 * @author iNahoo
 * @since 2022/3/3.
 */

import React, {} from 'react';

import weather_rain from '../static/weather_rain.png';
import weather_snow from '../static/weather_snow.png';
import weather_sun from '../static/weather_sun.png';
import weather_thunder from '../static/weather_thunder.png';

const mapping = {
  0: weather_sun,
  1: weather_rain,
  2: weather_snow,
  3: weather_thunder,
}

const WeatherIcon = props => {
  const {
    attr,
    size = 36,
  } = props;

  return (
    <>
      <span style={{
        display: 'block',
        backgroundImage: `url(${mapping[attr]})`,
        backgroundRepeat: 'no-repeat',
        backgroundSize: size,
        width: size,
        height: size,
      }}/>
    </>
  );
};

export default WeatherIcon;
